package com.hqyj.springboot.modules.common.vo;

public enum Test {
    SUN(0),MON(1),TUS(2),WED(3),THU(4),FRI(5),STA(6);
    public int value;

    Test(int value) {
        this.value = value;
    }

    public static Test getNextDay(Test nowDay){
        int nextDayValue = nowDay.value;
        if (++nextDayValue == 7){
            nextDayValue = 0;
        }
        return getWeekdayByValue(nextDayValue);
    }
    public static Test getWeekdayByValue(int value){
        for (Test c : Test.values()){
            if (c.value == value){
                return  c;
            }
        }
        return null;
    }
}

class Test2{
    public static void main(String[] args) {
        System.out.println("nowday ===>" + Test.STA);
        System.out.println("nowday int ===>" + Test.STA.value);
        System.out.println("nextday ===>" + Test.getNextDay(Test.STA));
    }
}
